package com.wwy.monitor.mapper.tddl;

import java.util.Date;
import java.util.List;

import com.wwy.monitor.model.tddl.dto.MonitorAlertMailDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface MonitorAlertMailMapper {
    /**
     * (æ°å¢æ°æ®)
     *
     * @param mcMail
     * @return
     */
    int insert(MonitorAlertMailDTO mcMail);

    /**
     * (æ¢å æ°æ®ï¼æ¯æ¬¡åªæ¢å ä¸æ¡)
     *
     * @param newFlag
     * @param hostIp
     * @param updateTime
     * @param oldFlag
     * @return
     */
    int occupyData(@Param(value = "oldFlag") Integer oldFlag, @Param(value = "newFlag") Integer newFlag,
                   @Param(value = "hostIp") String hostIp, @Param(value = "updateTime") Date updateTime);

    /**
     * (æ¥è¯¢æ°æ®)
     *
     * @param hostIp
     * @param flag
     * @return
     */
    List<MonitorAlertMailDTO> selectData(@Param(value = "hostIp") String hostIp, @Param(value = "flag") Integer flag,
                                         @Param(value = "start") Long start, @Param(value = "pageSize") Integer pageSize);

    /**
     * (æ´æ°æ°æ®)
     *
     * @param oldFlag
     * @param newFlag
     * @param id
     * @param updateTime
     * @return
     */
    int updateFlag(@Param(value = "oldFlag") Integer oldFlag, @Param(value = "newFlag") Integer newFlag,
                   @Param(value = "id") Long id, @Param(value = "updateTime") Date updateTime);

    /**
     * (éè¯éè¯¯æ°æ®)
     *
     * @param oldFlag
     * @param newFlag
     * @param updateTime
     * @return
     */
    int retryFailSend(@Param(value = "oldFlag") Integer oldFlag, @Param(value = "newFlag") Integer newFlag,
                      @Param(value = "updateTime") Date updateTime);

    /**
     * (å¤çè¶æ¶æ°æ®ï¼30åé)
     *
     * @param oldFlag
     * @param newFlag
     * @param updateTime
     * @return
     */
    int retryTimeOut(@Param(value = "oldFlag") Integer oldFlag, @Param(value = "newFlag") Integer newFlag,
                     @Param(value = "updateTime") Date updateTime);
}